#include<iostream>
#include<sstream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 110;
int arr[N];
int n;
int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}
int main()
{
	int t;
	cin >> t;
	string a;
	getline(cin, a);
	while (t--) {
		memset(arr, 0, sizeof(arr));
		getline(cin, a);
		stringstream line(a);
		n = 0;
		while (line >> arr[n]) {
			n++;
		}
		//for (int i = 0; i < n; i++) {
		//	cout << arr[i] << " ";
		//}
		int ma = -100;
		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				ma = max(ma, gcd(arr[i], arr[j]));
			}
		}
		cout << ma << endl;
	}
	return 0;
}
